//
//  WBBasicTableViewController.swift
//  weibo
//
//  Created by  郭航 on 16/6/25.
//  Copyright © 2016年 郭航. All rights reserved.
//

import UIKit

class WBBasicTableViewController: UITableViewController {
    
    override func loadView() {
        if !(WBUserInfor.shareWBUserInfor.isLogin) {
            setVisitorView()
        } else {
            super.loadView()
        }
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }

    // MARK: - 设置访客视图
    func setVisitorView() -> () {
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: #selector(WBBasicTableViewController.loginClick))
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: #selector(WBBasicTableViewController.loginClick))

        let basicView = WBBasicView()
        basicView.buttonCallBack = { [weak self] in
            self?.loginClick()
        }
        view = basicView
    }
    
    func loginClick() -> Void {
        let nav = UINavigationController(rootViewController: WBoAuthViewController())
        
        presentViewController(nav, animated: true, completion: nil)
    }
}
